package com.zyz.friend.controller.file;

import com.zyz.common.core.model.Result;
import com.zyz.common.file.model.OSSResult;
import com.zyz.friend.service.file.IFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/file")
public class FileController {

    @Autowired
    private IFileService fileService;

    @RequestMapping(value = "/upload",method = RequestMethod.POST)
    public Result<OSSResult> uploadFile(@RequestBody MultipartFile file) {
        return Result.ok(fileService.uploadFile(file));
    }

}
